import {request} from "./index";

export function getStudent(pagenum,pagesize,sort) {
    return request({
        method: 'get',
        url: '/student/query',
        params: {
            pageNum:pagenum,
            pageSize:pagesize,
            sort:sort
        }
    })
}
export function getStudentByid(sid,pagenum,pagesize,sort) {
    return request({
        method: 'get',
        url: '/student/query',
        params: {
            sId:sid,
            pageNum:pagenum,
            pageSize:pagesize,
            sort:sort
        }
    })
}
export function getStudentByname(sname,pagenum,pagesize,sort) {
    return request({
        method: 'get',
        url: '/student/query',
        params: {
            sName:sname,
            pageNum:pagenum,
            pageSize:pagesize,
            sort:sort
        }
    })
}
export function getStudentByclass(sclass,pagenum,pagesize,sort) {
    return request({
        method: 'get',
        url: '/student/query',
        params: {
            sClass:sclass,
            pageNum:pagenum,
            pageSize:pagesize,
            sort:sort
        }
    })
}

export function studentlogin(sId,pwd) {
    return request({
        method:'post',
        url:'/student/login',
        params:{
            sId:sId,
            pwd:pwd
        }
    })
}

export function studentdelete(sId) {
    return request({
        method:'post',
        url:'/student/delete/'+sId

    })
}

export function studentscore(sId) {
    return request({
        method:'get',
        url:'/grade/getScore',
        params:{
            sId:sId
        }

    })
}



export function adminlogin(name,pwd) {
    return request({
        method:'post',
        url:'/admin/login',
        params:{
            name:name,
            pwd:pwd
        }
    })
}

export function addstudent(age,phone,pwd,sClass,sName,sex) {
    return request({
        method:'post',
        url:'/student/add',
        params:{
            sName:sName,
            pwd:pwd,
            age:age,
            phone:phone,
            sClass:sClass,
            sex:sex
        }
    })
}

export function updatestudent(form) {
    return request({
        method:'post',
        url:'/student/update',
        params:{
            sId:form.sId,
            sName:form.sName,
            pwd:form.pwd,
            age:form.age,
            phone:form.phone,
            sClass:form.sClass,
            sex:form.sex
        }
    })
}

export function addgrade(sId,cId) {
    return request({
        method:'post',
        url:'/grade/add',
        params:{
            sId:sId,
            cId:cId
        }
    })
}

export function deleteCourse(sId,cId) {
    return request({
        method:'post',
        url:'/grade/deleteCourse',
        params:{
            sId:sId,
            cId:cId
        }
    })
}

export function addScore(sId,cId,score) {
    return request({
        method:'post',
        url:'/grade/addScore',
        params:{
            sId:sId,
            cId:cId,
            score:score

        }
    })
}





